import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
	{
		path: "",
		redirect: "/home",
	},
	{
		path: "/home",
		name: "Home",
		meta: {
			title: "首页",
		},
		component: () => import("../views/Home.vue"),
	},
	{
		path: "/about",
		name: "About",
		meta: {
			title: "关于",
		},
		component: () => import("../views/About.vue"),
	},
	//登录页
	{
		path: "/login",
		name: "Login",
		meta: {
			title: "登录",
		},
		component: () => import("../views/Login.vue"),
	},
	//订单页
	{
		path: "/order",
		name: "Order",
		meta: {
			title: "订单",
		},
		component: () => import("../views/Order.vue"),
	},
	//我的
	{
		path: "/about",
		name: "About",
		meta: {
			title: "我的",
		},
		component: () => import("../views/About.vue"),
	},
	{
		path: "/shop/search",
		name: "shopSearch",
		meta: {
			title: "搜索",
		},
		component: () => import("../views/shopSearch.vue"),
	},
	//店铺
	{
		path: "/shop/:id",
		name: "Shop",
		meta: {
			title: "店铺",
		},
		component: () => import("../views/Shop.vue"),
	},
	//分类
	{
		path: "/cate",
		name: "Cate",
		meta: {
			title: "分类",
		},
		component: () => import("../views/Cate.vue"),
	},
	//发现
	{
		path: "/find",
		name: "Find",
		meta: {
			title: "发现",
		},
		component: () => import("../views/Find.vue"),
	},
	//收藏
	{
		path: "/like",
		name: "Like",
		component: () => import("../views/Like.vue"),
	},
	//优惠
	{
		path: "/sale",
		name: "Sale",
		component: () => import("../views/Sale.vue"),
	},
	//地址选择
	{
		path: "/adress",
		name: "Adress",
		meta: {
			title: "地址",
		},
		component: () => import("../views/Adress.vue"),
	},
	//城市
	{
		path: "/city/:id",
		name: "City",
		meta: {
			title: "城市",
		},
		component: () => import("../views/City.vue"),
	},
];

const router = new VueRouter({
	routes,
});

export default router;
